package Terminal.UI.InterfacceDefault;

import java.awt.Font;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import Terminal.UI.PanelComponent;

public class PannelloAutenticazione extends PanelComponent{
	private JLabel usernameLabel = new JLabel();
	private JLabel passwordLabel = new JLabel();
	
	private JTextField usernameField = new JTextField();
	private JTextField passwordField = new JTextField();
	private JButton submit = new JButton();

	public PannelloAutenticazione(PanelComponent parent, JTextField usernameField, JTextField passwordField, JButton submit){
		super(parent);
		this.usernameField = usernameField;
		this.passwordField = passwordField;
		this.submit = submit;
	}
	
	@Override
	public JPanel createComponents() {
		pannellocomponente = new JPanel(null);
		usernameLabel.setText("Username");
		passwordLabel.setText("Password");
		
		usernameLabel.setBounds(250, 100, 300, 100);
		passwordLabel.setBounds(250, 200, 300, 100);
		
		usernameLabel.setFont(new Font(usernameLabel.getFont().getName(), Font.PLAIN,40));
	    passwordLabel.setFont(new Font(passwordLabel.getFont().getName(), Font.PLAIN,40));	    
	
		usernameField.setBounds(550, 125, 500, 50);
		passwordField.setBounds(550, 225, 500, 50);
		
		usernameField.setMargin(new Insets(0, 10, 0, 0));
		passwordField.setMargin(new Insets(0, 10, 0, 0));		
		    
	    
	    usernameField.setFont(new Font(usernameField.getFont().getName(), usernameField.getFont().getStyle(),24));
	    passwordField.setFont(new Font(passwordField.getFont().getName(), passwordField.getFont().getStyle(),24));	
	
		submit.setText("Login");			
		submit.setBounds(950, 325, 100, 50);
	 		
	    submit.setFont(new Font(submit.getFont().getName(), Font.PLAIN,24));
	    
	    pannellocomponente.add(usernameLabel);
	    pannellocomponente.add(passwordLabel);
	    pannellocomponente.add(usernameField);
	    pannellocomponente.add(passwordField);
	    pannellocomponente.add(submit);
	    
	    setSize(submit.getLocation().x+submit.getSize().width+100, submit.getLocation().y+submit.getSize().height+100);
	    
		return pannellocomponente;
	}

	@Override
	public void updateSize() {}

}
